package HttpServer;

import Command.SetCommand;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;

public class FunctionTable {

    public static Map<String, BiFunction> map ;

    public static void init(){
        System.out.println("表驱动初始化");
        map = new HashMap<>();

        map.put("/get",(k,v)->(HttpServerClient.pureLogDb.get((String) k)));

        map.put("/put",(k,v)-> {
            HttpServerClient.pureLogDb.put((SetCommand) k);
            return "null";
        } );
        map.put("/putWithExpire",(k,v)-> {
            HttpServerClient.pureLogDb.putWithExpireTime((SetCommand) k);
            return "null";
        } );

        map.put("/remove",(k,v)-> {
            HttpServerClient.pureLogDb.remove((String)k);
            return "null";
        } );


    }






}
